8aaa49
@@ -306,6 +306,10 @@
private void fetchNextGroup(Byte t) throws HiveException {
   public void closeOp(boolean abort) throws HiveException {
     joinFinalLeftData();
 
+    if (!((joinKeysObjectInspectors != null) && (joinKeysObjectInspectors[alias] != null))) {
+      super.closeOp(abort);
+    }
+
     // clean up
     for (int pos = 0; pos < order.length; pos++) {
       if (pos != posBigTable) {
@@ -362,6 +366,9 @@
private void joinFinalLeftData() throws HiveException {
       joinOneGroup();
       dataInCache = false;
       for (byte pos = 0; pos < order.length; pos++) {
+        if (candidateStorage[pos] == null) {
+          continue;
+        }
         if (this.candidateStorage[pos].rowCount() > 0) {
           dataInCache = true;
           break;
